Part Number Hot Search : 
PWR160 IC18F 10002 BTA08 B7838 STB5105 KS006 1N826UR
Product Description
Full Text Search
 

To Download AN4231 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  september 2013 docid024130 rev 2 1/22 AN4231 application note standby mode exit from flash to ram configuration settings for spc564bxx and spc56ecxx device family introduction the aim of this application note is to describe the correct procedure to manage one of the available low power modes for the spc564bxx and spc56ecxx devices; in particular the enter/exit sequence for the standby mode, which mode allows to reach the maximum power saving state. due to the multicore nature of the device, several combinations are allowed. in fact it is possible to exit from standby mode enabling z4 or z0 core and using backup ram or flash memory. following the four possible combinations: ? from z4 standby exit enabling the z4 core using flash memory allocated for z4 ? from z4 standby exit enabling the z4 core using the backup ram allocated for z4 ? from z4 standby exit enabling the z0 core using the flash memory allocated for z0 ? from z4 standby exit enabling the z0 core using the backup ram allocated for z0 all these combinations are obtained by easily modifyng the next example code. the reset generation module (rgm) contains the functionality to select the alternative boot via the backup ram on standby mode exit. this document describes about the standby exit from flash to ram, using z4 core because it is the lowest power mode that are enabled with a low latency for wakeup event. the cflash and dflash are kept in low power mode or in power down at the standby exit, then the phase2 and phase3 states of the reset state machine do not need to wait for flash initialization and all the processes are performed faster. www.st.com
contents AN4231 2/22 docid024130 rev 2 contents 1 low power modes overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1 settings for ram in standby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 standby mode transition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3 application code structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1 peripheral used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.2 code implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.2.1 disable software watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.2.2 clock generation module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2.3 pll configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2.4 reset generation module function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.2.5 wakeup unit configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.2.6 enter in standby mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.2.7 locator file configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.2.8 ram wakeup code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.3 conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 appendix a reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 a.1 reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
docid024130 rev 2 3/22 AN4231 list of tables list of tables table 1. ram configurations in modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 table 2. pconf setting for ram in standby . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 table 3. revision history. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
list of figures AN4231 4/22 docid024130 rev 2 list of figures figure 1. mc_me mode diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 figure 2. power domain organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 figure 3. mc_pcu events during power sequences (standby mode). . . . . . . . . . . . . . . . . . . . . . 9 figure 4. diagram flow of application code implemented . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 5. software watchdog function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 figure 6. cgm init function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 figure 7. pll configuration function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 figure 8. rgm init function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 figure 9. wkup init function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 figure 10. standby mode entry function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 figure 11. locator file and memory section organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
docid024130 rev 2 5/22 AN4231 low power modes overview 1 low power modes overview many automotive applications need to optimize power consumption in order to preserve the battery lifetime in all electronic components and minimize electromagnetic emissions. for this reason, microcontrollers of spc564bxx and spc56ecxx family have the possibility to remain in particular states called ?low power modes? when the primary target is to minimize the power consumption. the low power modes in the spc564bxx and spc56ecxx family devices are: ? halt mode ? stop mode ? standby mode the halt mode is intended as a first level low power mode, in which the platform is stopped but system clock remains the same as in running mode. this is a reduced-activity low-power mode during which the clock to the core is disabled. it is configured to switch off analog peripherals like pll, flash, main regulator etc. for efficient power management at the cost of higher wakeup latency. the stop mode is intended as an advanced low power mode, during which the clock of the platform is disabled. it is possible to switch off most of the peripheral oscillator at the cost of higher wakeup latency. the standby mode is a reduced leakage low power mode in which only the power domain 0 (always on) is connected and power supply is cut off from most of the device. wakeup from this mode takes a relatively long time and content is lost or must be restored from backup. those modes and their relative power domains are controlled by the power control unit (mc_pcu) which allows switching through four different power domains. when a power domain is disconnected from the supply, its power consumption is reduced to zero and the status information of the same power domain is lost.
low power modes overview AN4231 6/22 docid024130 rev 2 figure 1. mc_me mode diagram the microcontroller enters in standby mode from the drun or one of the run0...3 modes. the mode transition is performed by writing me_mctl register twice: ? 1st write: target_mode + key ? 2nd write: target_mode + inverted key refer to the explained code in this application note to know which are the target_mode and key values to enter in standby mode. in standby mode the power supply is turned off for most of the microcontroller. the only parts that are still turned on are pads mapped on wakeup lines in order to allow the standby exit using an external event and the power domain 0. the power domain 0 (pd0) contains some modules that are always enabled and allows to wake up the microcontroller once a wakeup event occurs. in this power domain the following modules are still powered: ? reset generation module (mc_rgm) ? power controller unit (mc_pcu) gapgri00362
docid024130 rev 2 7/22 AN4231 low power modes overview ? wakeup unit (wkpu) ? 8 kb of ram ? real time clock/ autonomous periodic interrupt (rtc_api) ? cansampler ? slow irc ? fast irc (can be optionally disabled) ? system status and configuration module (sscm) this mode is intended as follows: ? as an extreme low-power mode with everything powered down apart from the necessary circuitry to allow device wakeup and eventually a rtc/api (real time clock) implementation ? to be used by software to remain in the lowest power consumption state with no requirement to wake up quickly to exit from this mode, a wakeup event occurs. for this reason, the wake up unit is configured before entering in the standby mode.however, in addition to booting from the default location, the microcontroller is also configured to boot from the backup ram. in the case of booting from backup ram, it is also possible to keep the cflash and dflash disable by writing ?01? to the cflaon and dflaon field in the me_drun_mc register prior to standby entry. this allows a lower power consumption and a faster wakeup time, due to the fact that it does not need to wait for flash initialization (about ~120 us). if there is a standby mode request while any wakeup event is active, the microcontroller does not enter standby mode. in standby mode power domain 1 is disabled. power domains 2 and 3 are selectively configured to enable additional sram as defined in figure 2. for more information on the low power management refer to the chapter 11 of the rm. 1.1 settings for ram in standby standby mode offers maximum power saving. the level of power saving is software- controllable via the settings in the pcu_pconfn registers for power domain 2 onwards. power domain 0 stays connected to the power supply while power domain 1 is disconnected from the power supply. power domains 2 and 3 contain the backup ram extensions and is only powered down during standby mode. therefore, writing ?0? to the respective bits for the other modes do not power down those domains. depending on pconf[2-3] configuration, there are four possible combinations for the amount of ram active in standby mode as shown in the table 2 . the 40 kb option results in a non-contiguous address space.
low power modes overview AN4231 8/22 docid024130 rev 2 i it is possible to enable from 8 kb up to 96 kb of sram in standby mode for power configurations 2 and 3. figure 2. power domain organization table 1. ram configurations in modes mode(s) 8 kb 0x4000_0000 0x4000_1fff 56 kb 0x4000_2000 0x4000_ffff 32 kb 0x4001_0000 0x4001_7fff 32 kb 0x4001_8000 0x4001_ffff 128 kb 0x4002_0000 0x4003_ffff run,stop.halt on on on on on standby on pconf[2] pconf[3] off off table 2. pconf setting for ram in standby standby ram (kb) pconf[2] pconf[3] 800 64 (8+56) 1 0 96 (8 +56 +32) 1 1 40 (8+32) 0 1 gapgri00363
docid024130 rev 2 9/22 AN4231 standby mode transition 2 standby mode transition once standby is entered, it is only left via a system wakeup. on exiting the standby mode, all power domains are powered up according to the settings in the pcu_pconfn registers, and the drun mode is entered. in drun mode, at least power domains 0 and 1 are powered. figure 3 , shows an example for a mode transition from run0 to standby to drun. all power domains which have pcu_pconfn.stby cleared enter power-down phase. in this example, only power domain 1 is disabled during standby mode. when the mc_pcu receives the mode change request to standby mode, it starts the power down phase for power domain 1. during the power down phase, clocks are disabled and reset is asserted resulting in a loss of all the information for this power domain. then the power domain is disconnected from the power supply (power-down state). figure 3. mc_pcu events during power sequences (standby mode) when the mc_pcu receives a system wakeup request, it starts the power-up phase. the power domain is re-connected to the power supply and the voltage in power domain 1 increases slowly. once the voltage is in an operable range, clocks are enabled and the reset is deasserted (power-up state). gapgri00364
application code structure AN4231 10/22 docid024130 rev 2 3 application code structure this section gives an overview of the application code implemented to test the enter/exit of the standby mode from flash to ram using the z4 core. it is also discussed how to change the core during the standby exit and, in case of z4 core, how to configure the system memory in order to be available in vle mode for the core. figure 4 explains the application execution starting from a power on reset till the jump to the code in ram or in flash. in relation to this the core chooses an mmu init function unit which is added in order to manage the memory section for the core z4. figure 4. diagram flow of application code implemented 3.1 peripheral used ? device: spc564xb/c ? system clock: 120 mhz by pll initialization ? cgm (clock generation module): pll is configured as system clock ? rgm (reset generation module): set the status at the standby exit ? wkup (wake up unit): set an input pin to exit from standby ? me: mode entry in order to enter in standby mode gapgri00365
docid024130 rev 2 11/22 AN4231 application code structure 3.2 code implementation the application configures the device to: ? disable the software watchdog ? add a ram wait state due to the fact that one wait state is required when the system frequency is >64 mhz ? he wkup configure all modes and activate all clocks for all peripherals ? configure the pll to work at 120 mhz with an external oscillator of 40 mhz ? set the gpio in order to turn on some leds ? set the pll as output clock on the pa0 pin ? set the rmg standby bit to exit from the standby with the z4 core in ram ? set the led 2 (pe5) to toggle five times before to enter in standby ? set tmodule to: ? clear the wkup ? enable the wkup for a wake up event on the key1 (pe0) ? enable the wkup interrupt ? enable the falling edge ? enable the filter ? enable pullups on all wkup pins to stop leakage on unconnected pins ? wait until the key4 (pe3) is pulled low ? enter the standby mode from the mode entry mctl register. ? configure the locator file to copy from flash to ram the boot code ? configure the boot code for the z4 core in order to: ? configure the mmu for sram, bam, peripheral bridge. ? disable the software watchdog again ? initialize the stack pointer, sdata base and sdata2 base ? enable the spe in msr register ? configure the internal flash ? set the address to return from standby code in ram to toggle some leds 3.2.1 disable software watchdog this function allows disabling the software watchdog using a key word to permit the access to the control register of the swt module. the swt is disabled in order to avoid that the period execution of watchdog service could release a system reset. figure 5. software watchdog function
application code structure AN4231 12/22 docid024130 rev 2 3.2.2 clock generation module this function allows enabling all modes configuring in the runpc[0] mode, all peripheral on and to jump to the pll configuration function. figure 6. cgm init function 3.2.3 pll configuration this function allows to select the clock source for the pll. in this case the pll is driven by the fxosc oscillator at 40 mhz. then it configures the run[0] mode in order to enable the external oscillator, turning on the pll and setting the pll as system clock. the cgm module allows to set the several dividers (input, loop and output) in order to set the output of the pll to be at 120 mhz frequency. two keys are written in the mode entry mctl register in order to complete the mode entry. last part of the function configures the pa0 pin to be a clock out pin where it is possible to measure the pll frequency divided by four.
docid024130 rev 2 13/22 AN4231 application code structure figure 7. pll configuration function 3.2.4 reset generation module function this function allows selecting which core is used for booting after standby exit. if the boot_from_bkp_ram is set and if it is boot from flash or from backup ram. when using the z4 from ram in standby mode it needs to ensure that vle code is used. by default, the z0 core is the core that is on standby exit. figure 8. rgm init function 3.2.5 wakeup unit configuration this function allows to enable the wakeup unit in order to set a wakeup event, enabling the interrupt messaging from the wakeup/interrupt pads to the interrupt controller.
application code structure AN4231 14/22 docid024130 rev 2 figure 9. wkup init function the wkup6 is defined as 6. 3.2.6 enter in standby mode this function allows entering in standby mode in order to complete the mode transition. figure 10. standby mode entry function the standby_mode hex value for the standby is ?0x0000000d?. 3.2.7 locator file configuration the most important part of the locator file is the memory allocation where the sections are defined for flash and ram. there are also some variables used to copy code from flash to ram when booting.
docid024130 rev 2 15/22 AN4231 application code structure figure 11. locator file and memory section organization where sram is the system ram from 0x40000000 of 192 kb size, flash_rcw is a reserved section of flash and int_flash is the flash memory starting from 0x00000000 with 3 mb of size. stack_ram is the ram reserved for stack (4 kb). 3.2.8 ram wakeup code after the standby exit, in case of booting using the z4 core, it is necessary to set the memory management unit (mmu) in order to set flash or ram in vle mode, initializing the stack pointer r1, sdata base r13 and sdata2 base r2.
application code structure AN4231 16/22 docid024130 rev 2 moreover it is necessary to disable the software watchdog and to jump to the code in ram, to be executed. all this code is inserted in a section that is copied in the ram after boot. ram wakeup code function .section ".rom_code_to_be_copied", "vax" .vle .globl z4_ram_start_code .align 4 z4_ram_start_code: #****************** # enable spe in msr #****************** mfmsr r6 e_or2is r6, 0x0200 mtmsr r6 #tlb4 = pbridgea e_lis r3, 0x1004 mtmas0 r3 e_lis r3, 0xc000 e_or2i r3, 0x0800 mtmas1 r3 e_lis r3, 0xc000 e_or2i r3, 0x000a mtmas2 r3 e_lis r3, 0xc000 e_or2i r3, 0x003f mtmas3 r3 tlbwe #tlb6 = peripheral bridge and bam #0x6 0xc0000600 0xffc00028 0xffc0003f e_lis r3, 0x1006 mtmas0 r3
docid024130 rev 2 17/22 AN4231 application code structure e_lis r3, 0xc000 e_or2i r3, 0x0600 mtmas1 r3 e_lis r3, 0xffc0 e_or2i r3, 0x0028 mtmas2 r3 e_lis r3, 0xffc0 e_or2i r3, 0x003f mtmas3 r3 tlbwe #*********************** # re-configure mmu sram - extend from 4k to 256k. #*********************** e_lis r3, 0x1000 mtmas0 r3 e_lis r3, 0xc000 e_or2i r3, 0x0400 # 256 kb mtmas1 r3 e_lis r3, 0x4000 e_or2i r3, 0x0028 mtmas2 r3 e_lis r3, 0x4000 e_or2i r3, 0x003f mtmas3 r3 tlbwe #disable_watchdog e_lisr6, 65524 e_add16ir6, r6, -32752 e_lir7, 50464 se_stwr7, 0(r6) ##swt.sr.r = 0x0000d928; /* key */ e_lisr7, 65524 e_add16ir7, r7, -32752
application code structure AN4231 18/22 docid024130 rev 2 e_lir6, 55592 se_stwr6, 0(r7) ##swt.cr.r = 0xc000010a; /* disable wen */ e_lisr6, 65524 e_add16ir6, r6, -32768 e_lisr7, 0xc000 e_add16ir7, r7, 0x010a se_stwr7, 0(r6) e_lis r1, __sp_init@h # initialize stack pointer r1 to e_or2i r1, __sp_init@l # value in linker command file. e_lis r13, _sda_base_@h # initialize r13 to sdata base e_or2i r13, _sda_base_@l # (provided by linker). e_lis r2, _sda2_base_@h # initialize r2 to sdata2 base e_or2i r2, _sda2_base_@l # (provided by linker). e_stwu r0,-64(r1) # terminate stack. #tlb2 = 1m internal flash e_lis r3, 0x1002 mtmas0 r3 e_lis r3, 0xc000 e_or2i r3, 0x0500 mtmas1 r3 e_lis r3, 0x0000 e_or2i r3, 0x0020 mtmas2 r3 e_lis r3, 0x0000 e_or2i r3, 0x003f mtmas3 r3 tlbwe e_lis r3, return_from_standby_code_in_flash@h e_or2i r3, return_from_standby_code_in_flash@l mtlr r3 here: se_blr # branch to code in flash
docid024130 rev 2 19/22 AN4231 application code structure 3.3 conclusions standby mode allows maximizing power saving. during the standby mode, all memories that are not powered down in this mode, enter in a power saving state. this increases the power saving and the data in the memories are retained. this application note has described how to manage the standby exit from flash to ram, using the z4 core of the device. this is the lowest power consumption mode and also the fastest for wakeup process because it does not need wait for flash initialization. it is possible (see figure 8 ), modifying the rgm init function, to switch from flash to ram or from flash to flash and to decide which core is used. in case of usage of z0 core at standby exit, no mmu configuration is necessary.
reference documents AN4231 20/22 docid024130 rev 2 appendix a reference documents a.1 reference documents spc564bxx, spc56ecxx 32-bit mcu family built on the embedded power architecture (reference manual, rm0070, doc id 18196).
docid024130 rev 2 21/22 AN4231 revision history revision history table 3. revision history date revision changes 06-may-2013 1 initial release. 17-sep-2013 2 updated disclaimer.
AN4231 22/22 docid024130 rev 2 please read carefully: information in this document is provided solely in connection with st products. stmicroelectronics nv and its subsidiaries (?st ?) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described he rein at any time, without notice. a ll st products are sold pursuant to st?s terms and conditions of sale. purchasers are solely responsible for the choice, selection and use of the st products and services described herein, and st as sumes no liability whatsoever relating to the choice, selection or use of the st products and services described herein. no license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. i f any part of this document refers to any third party products or services it shall not be deemed a license grant by st for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoev er of such third party products or services or any intellectual property contained therein. unless otherwise set forth in st?s terms and conditions of sale st disclaims any express or implied warranty with respect to the use and/or sale of st products including without limitation implied warranties of merchantability, fitness for a particular purpose (and their equivalents under the laws of any jurisdiction), or infringement of any patent, copyright or other intellectual property right. st products are not designed or authorized for use in: (a) safety critical applications such as life supporting, active implanted devices or systems with product functional safety requirements; (b) aeronautic applications; (c) automotive applications or environments, and/or (d) aerospace applications or environments. where st products are not designed for such use, the purchaser shall use products at purchaser?s sole risk, even if st has been informed in writing of such usage, unless a product is expressly designated by st as being intended for ?automotive, automotive safety or medical? industry domains according to st product design specifications. products formally escc, qml or jan qualified are deemed suitable for use in aerospace by the corresponding governmental agency. resale of st products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by st for the st product or service described herein and shall not create or extend in any manner whatsoev er, any liability of st. st and the st logo are trademarks or registered trademarks of st in various countries. information in this document supersedes and replaces all information previously supplied. the st logo is a registered trademark of stmicroelectronics. all other names are the property of their respective owners. ? 2013 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia - belgium - brazil - canada - china - czech republic - finland - france - germany - hong kong - india - israel - ital y - japan - malaysia - malta - morocco - philippines - singapore - spain - sweden - switzerland - united kingdom - united states of america www.st.com


▲Up To Search▲   

 
Price & Availability of AN4231

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X